﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace PSE.Communication.Fix.Common
{
    [DataContract]
    public class RepositoryParameter
    {
        //TODO: Solucao provisoria, avaliar a possibilidade de utilizar arquivo posicional
        //separador utilizado entre os fields
        public const string FIELD_SEPARATOR = "◘•◘"; //◘ = alt+8, • = alt+7

        private int _id;
        private long _startId;
        private int _companyId;
        private int _length;
        private string _messageType;
        private string _message;
        DateTime _receiveDate;

        [DataMember]
        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }

        [DataMember]
        public long StartId
        {
            get { return _startId; }
            set { _startId = value; }
        }

        [DataMember]
        public int CompanyId
        {
            get { return _companyId; }
            set { _companyId = value; }
        }

        [DataMember]
        public int Length
        {
            get { return _length; }
            set { _length = value; }
        }

        [DataMember]
        public string MessageType
        {
            get { return _messageType; }
            set { _messageType = value; }
        }

        [DataMember]
        public string Message
        {
            get { return _message; }
            set { _message = value; }
        }

        [DataMember]
        public DateTime ReceiveDate
        {
            get { return _receiveDate; }
            set { _receiveDate = value; }
        }

        public override string ToString()
        {
            return Id.ToString() + FIELD_SEPARATOR + CompanyId.ToString() + FIELD_SEPARATOR + ReceiveDate.ToString("yyyy-MM-dd hh:mm:ss.fffffff") + FIELD_SEPARATOR + MessageType + FIELD_SEPARATOR + Message;
        }
    }
}
